package controller;

import entity.SocialServices;
import service.SocialServicesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;

@RestController
@RequestMapping("/api/socialservices")
public class SocialServicesController {

    @Autowired
    private SocialServicesService socialServicesService;

    @GetMapping("/{id}")
    public SocialServices getById(@PathVariable Integer id) {
        return socialServicesService.getById(id);
    }

    @GetMapping("/all")
    public List<SocialServices> getAll() {
        return socialServicesService.getAll();
    }

    @GetMapping("/student/{studentId}")
    public List<SocialServices> getByStudentId(@PathVariable Integer studentId) {
        return socialServicesService.getByStudentId(studentId);
    }

    @PostMapping
    public int create(@RequestBody SocialServices obj) {
        return socialServicesService.create(obj);
    }

    @PutMapping
    public int update(@RequestBody SocialServices obj) {
        return socialServicesService.update(obj);
    }

    @DeleteMapping("/{id}")
    public int delete(@PathVariable Integer id) {
        return socialServicesService.delete(id);
    }
}